package com.asit.config;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.kafka.common.serialization.Serializer;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author:
 * @description: 自定义kafka value的序列化
 * @data: 2020/10/15 10:27 PM
 */
public class JSONSerializer implements Serializer<JSONObject>{

    @Override
    public void configure(Map<String, ?> configs, boolean isKey) {

    }

    @Override
    public byte[] serialize(String s, JSONObject jsonObject) {
        return JSON.toJSONBytes(jsonObject);
    }

    @Override
    public void close() {

    }
}
